
let searchFormatter = {}

searchFormatter.searchFormFormat = function (searchForm) {
  let filterList = []
  for (let index in searchForm) {
    if (searchForm[index] === null || (typeof searchForm[index] === 'string' && searchForm[index] === '')) {
      continue
    } else if ((typeof searchForm[index] === 'string' && searchForm[index] !== '') || (typeof searchForm[index] === 'number' && searchForm[index] !== -1)) {
      filterList.push({
        filterKey: index,
        filterValue: searchForm[index]
      })
    } else if (typeof searchForm[index] === 'object' && searchForm[index] instanceof Date) {
      filterList.push({
        filterKey: index,
        filterValue: searchForm[index].getTime()
      })
    } else {
      filterList.push({
        filterKey: index,
        filterValue: searchForm[index]
      })
    }
  }
  return filterList
};
export default searchFormatter
